﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class DragItem : MonoBehaviour,IBeginDragHandler,IDragHandler,IEndDragHandler
{
    public delegate void DragItemDelegate (PointerEventData eventData);

    public DragItemDelegate OnBeginDragDelegate;
    public DragItemDelegate OnDragDelegate;
    public DragItemDelegate OnEndDragDelegate;
    
    public void OnBeginDrag(PointerEventData eventData)
    {
        if (OnBeginDragDelegate != null)
        {
            OnBeginDragDelegate(eventData);
        }
    }

    public void OnDrag(PointerEventData eventData)
    {
        if (OnDragDelegate != null)
        {
            OnDragDelegate(eventData);
        }
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        if (OnEndDragDelegate != null)
        {
            OnEndDragDelegate(eventData);
        }
    }
}
